package chapter21;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class TestStudent {
    public static void main(String[] args){
        Map<String ,Student> studentMap = new HashMap<String,Student>();
        Student s1 =new Student("2021001","菜1坤",20);
        Student s2 =new Student("2021002","菜2坤",23);
        Student s3 =new Student("2021003","菜3坤",19);
        studentMap.put("2021001",s1);
        studentMap.put("2021002",s2);
        studentMap.put("2021003",s3);
        Set<String> sk =studentMap.keySet();
        for (String aa : sk ){
            Student sg = studentMap.get(aa);
            System.out.println(sg.toString());
        }
        System.out.println("...............................");
        fillStudent("2021001",studentMap);
    }
    public static String fillStudent(String key, Map studentMap){
        if(studentMap.containsKey(String.valueOf(key))){
            System.out.println(studentMap.get(String.valueOf(key)).toString());
        }else {
            System.out.println("该学生不存在");
        }
        return "";
    }
}
